/**
 *
 */
package com.jycode.commons.dao;

import java.util.Iterator;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.jycode.commons.genericdao.GenericHibernateDAO;
import com.jycode.commons.model.SysUser;

/**
 * @author "banlyst <banlyst@gmail.com>"
 *
 */
@SuppressWarnings("serial")
@Repository("sysUserDAO")
public class SysUserDAOImpl extends GenericHibernateDAO<SysUser, Long> implements SysUserDAO {

	public SysUserDAOImpl() {
		super(SysUser.class);
	}


	/* (non-Javadoc)
	 * @see com.jycode.ishop.dao.UserDAO#findByName(java.lang.String)
	 */
	public List<SysUser> findByName(String name)
    {
    	return findByNamedQuery("findByName", name);
    }
    /* (non-Javadoc)
	 * @see com.jycode.ishop.dao.UserDAO#findByEmail(java.lang.String)
	 */
    public List<SysUser> findByEmail(String name)
    {
    	return findByNamedQuery("findByEmail", name);
    }
    /* (non-Javadoc)
	 * @see com.jycode.ishop.dao.UserDAO#findByNamePassword(java.lang.String, java.lang.String)
	 */
    public List<SysUser> findByNamePassword(String name, String password)
    {
    	return findByNamedQuery("findByNamePassword", name, password);
    }
    /* (non-Javadoc)
	 * @see com.jycode.ishop.dao.UserDAO#iterateByName(java.lang.String)
	 */
    public Iterator<SysUser> iterateByName(String namesLikePattern)
    {
    	return iterateByNamedQuery("iterateByName", namesLikePattern);
    }
    /* (non-Javadoc)
	 * @see com.jycode.ishop.dao.UserDAO#doLogin(java.lang.String, java.lang.String)
	 */
    public SysUser doLogin(String name, String password){ return uniqueResult(findByNamedQuery("doLogin", name, password)); }


}
